﻿using MediatR;
using RBAC.LuFang.API.Application.Command.heathCommand;
using RBAC.LuFang.Domain.Traceability;
using RBAC.LuFang.Domin.Services.TraceabilityService;

namespace RBAC.LuFang.API.Application.CommandHandlers.heathCommandhandler
{
    //修改保健
    public class UpdHeathCommandHandler:IRequestHandler<UpdHeathCommand,int>
    {
        private readonly IGoodsService _goodsService;

        public UpdHeathCommandHandler(IGoodsService goodsService)
        {
            _goodsService = goodsService;
        }

        public async Task<int> Handle(UpdHeathCommand request, CancellationToken cancellationToken)
        {
            var model = new health() { healthid=request.healthid, healthDay=request.healthDay, healthName=request.healthName, healthType=request.healthType, goodsId=request.goodsId };
            return await _goodsService.UpdHeath(model);
        }
    }
}
